<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>奇异果直播聚合 - 搜索 - {{$key}}</title>
    <meta name="keywords" content="{{$key}}" />
    <meta name="description" content="搜点有意思的" />
    <link href="{{asset('home_new/css/global.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/qyg2016.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/qyg_list_2016.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home/js/skin/layer.css')}}" type="text/css" rel="stylesheet" />
    <link href="{{asset('home_new/css/loginPop.css')}}" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="{{asset('home/js/jquery-3.1.0.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('pulgin/layer/layer.js')}}"></script>
    <script src="http://static.geetest.com/static/tools/gt.js"></script>
    <link rel="icon" href="{{asset('home_new/favicon.ico')}}" />
    <style>
        .pagination{
            display: table;margin: 0 auto;
        }
        .pagination li{
            float:left;
        }
        .global_page li.active a{
            color: #fff;
            background-color: #2EB872;
        }
        h2 em{
            color: #cc0000;
            font-style: normal;
        }
        .list_name em{
            color: #cc0000;
            font-style: normal;
        }
        .page_center{
            clear: both;
        }
    </style>
</head>

<body style="background: #FFFFFF;">
<div class="list_box list_box2">
<div class="list_header">

    <div class="list_header_nav">

        <div class="list_nav_left">
            <a href="{{route('search')}}"><img src="{{asset('home_new/images/list_logo.png')}}"></a>

                <input type="search" placeholder="{{$key}}" class="list_search" name="key" value="{{$key}}" id="key"/>
                <input type="hidden" name="type" value="{{$type}}" id="type">
                <button class="list_search_btn" type="submit">搜一下</button>

        </div>

        @if(session('user'))
            <div class="inner_user list_pic_magin">
                <a href="{{route('userIndex')}}">个人中心</a>
                <a href="{{route('logout')}}">注销</a>
                <img src="{{session('user')->head_img}}" onerror="this.src='{{asset('img/100100.png')}}'">
            </div>
            @else
            <div class="inner_login">
                <a class="login_in global_gaNode" href="#">
                    登录
                </a>
                <a class="logoutCss global_gaNode" href="#">
                    注册
                </a>
            </div>
        @endif

    </div>
</div>

<div class="list_nav">
    <div class="list_nav_magin">
        <div class="search_nav_left">
            <ul>
                <li>
                    <a href="{{route('index')}}" data-type="" @if($type=='')style="color: #67932c;"@endif>聚合</a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-type="live" @if($type=='live')style="color: #67932c;"@endif>直播</a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-type="video" @if($type=='video')style="color: #67932c;"@endif>视频</a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-type="article" @if($type=='article')style="color: #67932c;"@endif>好文</a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-type="gallery" @if($type=='gallery')style="color: #67932c;"@endif>图库</a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-type="show" @if($type=='show')style="color: #67932c;"@endif>奇异秀</a>
                </li>
            </ul>
        </div>
    </div>
</div>
@section('content')
    @show

<div class="list_foot foot_banner">
    <div class="search_footer_nav list_foot_nav">
        <div class="f_wxgzh">
            <img src="{{asset('home_new/images/wxerm.png')}}">
            <span>微信公众号
开播早知道</span>
        </div>
        <div class="f_wxgzh">
            <img src="{{asset('home_new/images/qqq.png')}}">
            <span>粉丝扣扣群
欢乐一锅煮</span>
        </div>
        <div class="search_footer_inner">
					<span><a href="http://www.qiyiguo.tv/qyg/notice" target="_blank" >奇异果资讯</a>
						<a href="http://www.qiyiguo.tv/about/aboutQYG">关于奇异果</a>
						<a href="http://www.qiyiguo.tv/about/joinus">联系我们</a>
					</span>
            <p>© 2016 QIYIGUO 奇异果聚合 滇ICP备12006567号-20</p>
            <p>昆明尚合科技有限公司 | </p>
        </div>
    </div>
</div>
</div>
<span style="display:none;">
    <!--统计代码-->
{!! $global->count_code !!}
<!--推送代码-->
    {!! $global->push_code !!}
        </span>
</body>

</html>
<script>

    $(function() {

        //注册
        $('.logoutCss').click(function(){
            location.href = "http://www.qiyiguo.tv/register";
        });
        var url = "{{url('auth/startCaptcha')}}";
        var reg_url = "http://www.qiyiguo.tv/register";
        var forget_url = "http://www.qiyiguo.tv/forget";
        var qq_login = "http://www.qiyiguo.tv/auth/qq";
        var wx_login = "http://www.qiyiguo.tv/auth/weixinWeb";
        var wb_login = "http://www.qiyiguo.tv/auth/weibo";
        var login = {
            init: function () {

                $('.login_in').click(function () {

                    layer.open({
                        type: 1,
                        title: false,
                        area: ['auto', 'auto'],
                        shift: 'left', //从左动画弹出
                        closeBtn: 0,
                        shadeClose: true,
                        zIndex: 899990,
                        content: '<div class="login-pop"data-point="dlk"><div class="login-pop-close"></div><div class="login-pop-tab"><ul><li><a href="#" class="t-login current">登录</a></li><li><a href="' + reg_url + '" target="_blank">注册</a></li></ul></div><div class="login-pop-cont clearfix"><div class="c-item clearfix popLogin"><form method="post" action=""><input type="hidden" name="name" value="login"><input type="hidden" name="dopost" value="login"><input type="hidden" name="gourl" value=""><p><input class="ipt" type="text" name="userid" id="phone" placeholder="电话号码"></p><p><input class="ipt" type="password" name="pwd" id="password" placeholder="密码"></p><div class="toreg clearfix"><input class="btn-sub"type="button"value="登录" id="popup-submit"><p>没有账号？<a href="' + reg_url + '" title="马上注册" target="_blank">马上注册</a></p></div></form></div><div class="c-oth"><p>用第三方账号直接登录</p><div><a href="' + qq_login + '" class="btn-qq" title="QQ账号登录"data-point-2="qq"><span class="dy-icon dy-sina"></span><span>QQ账号登录</span></a></div><div><a href="' + wx_login + '" class="btn-wx" title="微信登录"data-point-2="qq"><span class="dy-icon dy-wx"></span><span>微信登录</span></a></div><div><a href="' + wb_login + '" class="btn-sina" title="微博登录"data-point-2="sina"><span class="dy-icon dy-qq"></span><span>微博登录</span></a></div><p class="forget-pass"><a href="' + forget_url + '" target="_blank">忘记密码？</a></p></div></div></div>'
                    })
                    $(".t-login").on("click", function () {
                        $(".t-login").addClass("current");
                        $(".t-reg").removeClass("current");
                        $(".popLogin").removeClass("hide");
                        $(".popReg").addClass("hide");
                    })
                    $(".t-reg").on("click", function () {
                        $(".t-reg").addClass("current");
                        $(".t-login").removeClass("current");
                        $(".popLogin").addClass("hide");
                        $(".popReg").removeClass("hide");
                    })
                    $(".login-pop-close").on("click", function () {
                        layer.closeAll();
                    })
                    @if(empty(session('login_sign')))
                        document.onkeydown = function(e){

                        var ev = document.all ? window.event : e;
                        if(ev.keyCode==13) {
                            if($('#remember').is(':checked')){
                                var remember = 1;
                            }else{
                                var remember = 0;
                            }
                            var phone = $("#phone").val();
                            var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                            if(!myreg.test(phone))
                            {
                                layer.msg('请输入有效的手机号码！');
                                return;
                            }
                            var password = $("#password").val();
                            if(password.length == 0){
                               layer.msg('密码不能为空！');
                                return;
                            }
                            $.ajax({
                                url: "{{url('auth/quickLogin')}}",
                                type: "post",
                                // dataType: "json",
                                data: {
                                    // 用户名和密码等其他数据，自己获取，不做演示
                                    phone: phone,
                                    password: password,
                                    remember: remember,
                                    _token: "{{csrf_token()}}",
                                },
                                // 这里是正确返回处理结果的处理函数
                                // 假设你就返回了1，2，3
                                // 当然，正常情况是返回JSON数据
                                success: function (result) {
                                    if (result == 'success') {
                                        location.reload();
                                    } else {
                                        layer.alert(result,{icon: 2},function () {
                                            location.reload();
                                        });
                                    }
                                }
                            });
                            // 提交验证码信息，比如登陆页面，你需要提交登陆信息，用户名和密码等登陆数据

                        }
                    }



                    $("#popup-submit").click(function () {
                        if($('#remember').is(':checked')){
                            var remember = 1;
                        }else{
                            var remember = 0;
                        }
                        var phone = $("#phone").val();
                        var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                        if(!myreg.test(phone))
                        {
                            layer.msg('请输入有效的手机号码！');
                            return;
                        }
                        var password = $("#password").val();
                        if(password.length == 0){
                           layer.msg('密码不能为空！');
                            return;
                        }
                        $.ajax({
                            url: "{{url('auth/quickLogin')}}",
                            type: "post",
                            // dataType: "json",
                            data: {
                                // 用户名和密码等其他数据，自己获取，不做演示
                                phone: phone,
                                password: password,
                                remember: remember,
                                _token: "{{csrf_token()}}",
                            },
                            // 这里是正确返回处理结果的处理函数
                            // 假设你就返回了1，2，3
                            // 当然，正常情况是返回JSON数据
                            success: function (result) {
                                if (result == 'success') {
                                    location.reload();
                                } else {
                                    layer.alert(result,{icon: 2},function () {
                                        location.reload();
                                    });
                                }
                            }
                        });

                    });


                    @else
                    // 代码详细说明
                    var handlerPopup = function (captchaObj) {
                        // 注册提交按钮事件，比如在登陆页面的登陆按钮
                        $("#popup-submit").click(function () {
                            // 此处省略在登陆界面中，获取登陆数据的一些步骤
                            // 先校验是否点击了验证码

                            var validate = captchaObj.getValidate();
                            var phone = $("#phone").val();
                            var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                            if (!myreg.test(phone)) {
                                layer.msg('请输入有效的手机号码！');
                                return;
                            }
                            var password = $("#password").val();
                            if (password.length == 0) {
                                layer.msg('密码不能为空！');
                                return;
                            }
                            if (!validate) {
                                layer.msg('请先完成验证！');
                                return;
                            }
                            // 提交验证码信息，比如登陆页面，你需要提交登陆信息，用户名和密码等登陆数据
                            $.ajax({
                                url: "{{url('auth/verifyLogin')}}",
                                type: "post",
                                // dataType: "json",
                                data: {
                                    // 用户名和密码等其他数据，自己获取，不做演示
                                    phone: phone,
                                    password: password,
                                    remember: 0,
                                    _token: "{{csrf_token()}}",
                                    geetest_challenge: validate.geetest_challenge,
                                    geetest_validate: validate.geetest_validate,
                                    geetest_seccode: validate.geetest_seccode
                                },
                                // 这里是正确返回处理结果的处理函数
                                // 假设你就返回了1，2，3
                                // 当然，正常情况是返回JSON数据
                                success: function (result) {
                                    if (result == 'success') {
                                        location.reload();
                                    } else {
                                        layer.alert(result,{icon: 2},function () {
                                            location.reload();
                                        });
                                    }
                                }, error: function (data) {
                                    console.log(data)
                                }
                            });
                        });
                        captchaObj.bindOn("#popup-submit");
                        captchaObj.appendTo(".login-pop");
                        geetest = captchaObj;
                    };

                    $.ajax({
                        // 获取id，challenge，success（是否启用failback）
                        url: url + "/" + (new Date()).getTime(), // 加随机数防止缓存
                        type: "get",
                        dataType: "json",
                        success: function (data) {
                            // 使用initGeetest接口
                            // 参数1：配置参数
                            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
                            initGeetest({
                                gt: data.gt,
                                challenge: data.challenge,
                                product: "popup", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                                offline: !data.success // 表示用户后台检测极验服务器是否宕机，与SDK配合，用户一般不需要关注
                            }, handlerPopup);
                        }
                    });

                    @endif
                });
            }
        }
        login.init();
    });
    $(function(){
        document.onkeydown = function(e){
            var ev = document.all ? window.event : e;
            if(ev.keyCode==13) {
                var phone = $("#phone").val();
                var pwd = $("#password").val();
                if(phone.length==0){
                    return;
                }
                var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if(!myreg.test(phone))
                {
                    layer.msg('请输入有效的手机号码！')
                    return;
                }
                if(pwd.length<6){
                    layer.msg('密码格式不正确！')
                    return;
                }
                return geetest.show();
            }
        }

    })
    $(function(){
        $('.search_nav_left ul li a').click(function(){
            var type = $(this).data('type');
            var key = $('#key').val();

            if(!key){
                key = 'no';
            }
            location.href = "{{route('search')}}"+'/'+key+'/'+type;
        });
        $('.list_search_btn').click(function(){
            var type = $('#type').val();
            var key = $('#key').val();

            if(!key){
                key = 'no';
            }
            location.href = "{{route('search')}}"+'/'+key+'/'+type;
        })
        $('#key').focus(function(){
            //$(this).val('');
            document.onkeydown = function(e){
                var ev = document.all ? window.event : e;
                if(ev.keyCode==13) {
                    var key = $('#key').val();
                    var type = $('#type').val();
                    if(key){
                        location.href = "{{route('search')}}"+'/'+key;
                    }else{
                        layer.msg('请输入关键字！');
                    }
                }
            }
        })
    })
</script>
